package reference;

import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;

/**
 * Author: hu
 * Date: 2022/3/25 10:58
 */
public class Softreference {

    public static void main(String[] args) {
        Stu st = new Stu(1,"susan");
        WeakReference<Stu> sr = new WeakReference(st);
        System.out.println(sr.get());
        st =null;
        System.gc();
        System.out.println(sr.get());
    }
}
